//-----------------------------------------------------------------------
// <copyright file="Image.cs" company="Robert MacLean">
//     This file is released under the LGPL. For more information see 
//     http://gallery2.codeplex.com.
//     Originally created by Robert MacLean http://www.sadev.co.za
// </copyright>
//-----------------------------------------------------------------------

namespace SADev.Gallery2.Protocol
{
    using System;
    using System.Globalization;
    using System.Collections.ObjectModel;

    /// <summary>
    /// Represents a G2 Image
    /// </summary>
    public class Image
    {
        /// <summary>
        /// Gets or sets the id.
        /// </summary>
        /// <value>The id.</value>
        public int Id { get; set; }

        /// <summary>
        /// Gets or sets the raw dimensions.
        /// </summary>
        /// <value>The raw dimensions.</value>
        public ImageDimensions RawDimensions { get; set; }

        /// <summary>
        /// Gets or sets the resized dimensions.
        /// </summary>
        /// <value>The resized dimensions.</value>
        public ImageDimensions ResizedDimensions { get; set; }

        /// <summary>
        /// Gets or sets the thumbnail dimensions.
        /// </summary>
        /// <value>The thumbnail dimensions.</value>
        public ImageDimensions ThumbnailDimensions { get; set; }

        /// <summary>
        /// Gets or sets the caption.
        /// </summary>
        /// <value>The caption.</value>
        public string Caption { get; set; }

        /// <summary>
        /// Gets or sets the title.
        /// </summary>
        /// <value>The title.</value>
        public string Title { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="Image"/> is hidden.
        /// </summary>
        /// <value><c>true</c> if hidden; otherwise, <c>false</c>.</value>
        public bool Hidden { get; set; }

        /// <summary>
        /// Gets the raw image URL.
        /// </summary>
        /// <value>The raw image URL.</value>
        public Uri RawImageUrl
        {
            get
            {
                return new Uri(String.Format(CultureInfo.CurrentCulture, "/d/{0}-1/{1}", this.RawDimensions.FileName, this.Title), UriKind.Relative);
            }
        }

        /// <summary>
        /// Gets or sets the extension.
        /// </summary>
        /// <value>The extension.</value>
        public string Extension { get; set; }

        /// <summary>
        /// Gets or sets the resized version.
        /// </summary>
        /// <value>The resized version.</value>
        public Collection<ImageDimensions> ResizedVersion { get; set; }

        /// <summary>
        /// Gets or sets the clicks.
        /// </summary>
        /// <value>The clicks.</value>
        public int Clicks { get; set; }
    }
}